import fetch from 'common/src/utils/fetch'
const api_name = 'api/welcomeservice'
const group_name = 'tutorSchool'
const group_name_two = 'tutorApplicationAuthorith'
const group_name_three = 'tutorNumber'


/**
 *新增学堂关系
 */
function addSchool(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'post',
    data: data
  });
}

/**
 *编辑学堂关系
 */
function editSchool(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'put',
    data: data
  });
}

/**
 *删除学堂
 */
function deleteSchool(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'delete',
    data: data
  });
}

/**
 *查找学堂，下拉
 */
function findSchool(data) {
  return fetch({
    url: `${api_name}/${group_name}/list`,
    method: 'post',
    data: data
  });
}


/**
 *通过Id查找
 */
function findSchoolById(id) {
  return fetch({
    url: `${api_name}/${group_name}/${id}`,
    method: 'get'
  });
}


/**
 *查找专业大类
 */
function findSchoolProfession(data) {
  return fetch({
    url: `${api_name}/${group_name}/profession/${data}`,
    method: 'post',
    data: {}
  });
}


/**
 *新增导师申请权限关系
 */
function addTutorAuth(data) {
  return fetch({
    url: `${api_name}/${group_name_two}`,
    method: 'post',
    data: data
  });
}

/**
 *编辑导师申请权限关系
 */
function editTutorAuth(data) {
  return fetch({
    url: `${api_name}/${group_name_two}`,
    method: 'put',
    data: data
  });
}

/**
 *删除导师申请权限关系
 */
function deleteTutorAuth(data) {
  return fetch({
    url: `${api_name}/${group_name_two}`,
    method: 'delete',
    data: data
  });
}


/**
 *通过Id查找导师申请权限关系
 */
function findTutorAuthById(id) {
  return fetch({
    url: `${api_name}/${group_name_two}/${id}`,
    method: 'get'
  });
}

/**
 *新增通用名额配比
 */
function addTutorNumber(data) {
  return fetch({
    url: `${api_name}/${group_name_three}/currency`,
    method: 'post',
    data: data
  });
}

/**
 *查询通用名额配比
 */
function findTutorNumber(type) {
  return fetch({
    url: `${api_name}/${group_name_three}/currency?type=` + type,
    method: 'get'
  });
}

/**
 *新增特殊名额设置
 */
function addParticularTutorNumber(data) {
  return fetch({
    url: `${api_name}/${group_name_three}`,
    method: 'post',
    data: data
  });
}


/**
 *编辑特殊名额设置
 */
function editParticularTutorNumber(data) {
  return fetch({
    url: `${api_name}/${group_name_three}`,
    method: 'put',
    data: data
  });
}

/**
 *删除特殊名额设置
 */
function deleteParticularTutorNumber(data) {
  return fetch({
    url: `${api_name}/${group_name_three}`,
    method: 'delete',
    data: data
  });
}

/**
 *新增学堂关系
 */
function syncSchool(data) {
  return fetch({
    url: `${api_name}/${group_name}/changeSchool`,
    method: 'put',
    data: data,
    showMask: false
  });
}
/*导出照片获取key
 */
function exportStuPicture(data) {
  return fetch({
    url: `/api/studentservice/studentInfo/exportStuPicture`,
    // url: `${api_name}/${group_name}/studentInfo/exportStuPicture`,
    method: 'post',
    data: data,
  });
}
 /*导出照片url
 */
function getPictureUrl(data) {
  return fetch({
    url: `/api/studentservice/studentInfo/getPictureUrl?key=` + data,
    method: 'get'
  });
}
 /*导出照片file
 */
function getPictureFile(data) {
  return fetch({
    url: `/api/studentservice/studentInfo/getPictureFile?path=` + data,
    method: 'get'
  });
}

export default {
  addSchool: addSchool,
  editSchool: editSchool,
  deleteSchool: deleteSchool,
  findSchoolById: findSchoolById,
  findSchoolProfession: findSchoolProfession,
  addTutorAuth: addTutorAuth,
  editTutorAuth: editTutorAuth,
  deleteTutorAuth: deleteTutorAuth,
  findTutorAuthById: findTutorAuthById,
  addTutorNumber: addTutorNumber,
  addParticularTutorNumber: addParticularTutorNumber,
  deleteParticularTutorNumber: deleteParticularTutorNumber,
  editParticularTutorNumber: editParticularTutorNumber,
  findTutorNumber: findTutorNumber,
  findSchool: findSchool,
  syncSchool: syncSchool,
  exportStuPicture: exportStuPicture,
  getPictureUrl: getPictureUrl,
  getPictureFile: getPictureFile
}
